#define _CRT_SECURE_NO_WARNINGS 1
#include <stdio.h>

int main()
{
	int money = 0;
	scanf("%d", &money);

	int total = 0;
	int price = 1;
	int exchange = 2;
	int Bottle_num = money / price;

	total = Bottle_num;

	while (Bottle_num != (2 * exchange - 1) && Bottle_num / exchange != 0)
	{
		total += Bottle_num / exchange;
		Bottle_num = Bottle_num / exchange + Bottle_num % exchange;
	}
	total += 2;
	
	printf("total = %d", total);

	return 0;
}
